home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 January: Mac OS SDK / Dev.CD Jan 96 SDK / Dev.CD Jan 96 SDK2.toast / Development Kits (Disc 2) / QuickDraw™ 3D / Development / QAL DDK 1.0.3 / Headers / Drive3D_system.h next >
Encoding:
C/C++ Source or Header  |  1995-06-22  |  8.8 KB  |  216 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        Drive3D_system.h                                         **
  4.  **                                                                          **
  5.  **     Purpose:     Header file for 3D drawing engine SPI                     **
  6.  **                                                                          **
  7.  **     Author:        Mike W. Kelley                                             **
  8.  **                                                                          **
  9.  **     Copyright (C) 1994-95 Apple Computer, Inc.  All rights reserved.     **
  10.  **        OpenGL™ is a trademark of Silicon Graphics, Inc.                     **
  11.  **                                                                          **
  12.  *****************************************************************************/
  13.  
  14. #ifndef _Drive3D_system_h
  15. #define _Drive3D_system_h
  16.  
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20.  
  21. /************************************************************************************************
  22.  *
  23.  * Typedefs of texture/bitmap method functions provided by the drawing engine.
  24.  *
  25.  ***********************************************************************************************/
  26.  
  27. typedef TQAError (*TQATextureNew) (
  28.     unsigned long        flags,                /* Mask of kQATexture_xxx flags */
  29.     TQAImagePixelType    pixelType,            /* Depth, color space, etc. */
  30.     const TQAImage        images[],            /* Image(s) for texture */
  31.     TQATexture            **newTexture);        /* (Out) Newly created TQATexture, or NULL on error */ 
  32.  
  33. typedef TQAError (*TQATextureDetach) (
  34.     TQATexture            *texture);            /* Previously allocated by QATextureNew() */
  35.  
  36. typedef void (*TQATextureDelete) (
  37.     TQATexture            *texture);            /* Previously allocated by QATextureNew() */
  38.  
  39. typedef TQAError (*TQABitmapNew) (
  40.     unsigned long        flags,                /* Mask of kQABitmap_xxx flags */
  41.     TQAImagePixelType    pixelType,            /* Depth, color space, etc. */
  42.     const TQAImage        *image,                /* Image */
  43.     TQABitmap            **newBitmap);        /* (Out) Newly created TQABitmap, or NULL on error */ 
  44.  
  45. typedef TQAError (*TQABitmapDetach) (
  46.     TQABitmap            *bitmap);            /* Previously allocated by QABitmapNew() */
  47.  
  48. typedef void (*TQABitmapDelete) (
  49.     TQABitmap            *bitmap);            /* Previously allocated by QABitmapNew() */
  50.  
  51. /************************************************************************************************
  52.  *
  53.  * Typedefs of private (system-only) functions provided by the drawing engine.
  54.  *
  55.  * The TQADrawPrivateNew function returns a TQADrawPrivate *, which points to the
  56.  * engine-specific private data created for the context. (TQADrawPrivate is a dummy
  57.  * type which is then cast to the correct engine-specific datatype by the engine code.)
  58.  *
  59.  * The TQADrawPrivateDelete function deletes the engine-specific private data.
  60.  *
  61.  * TQAStorePrivateNew and TQAStorePrivateDelete provide the same function as QADrawPrivateNew
  62.  * and TQADrawPrivateDelete, but for the texture and bitmap storage context.
  63.  *
  64.  * TQADrawMethodGet and TQAStoreMethodGet are called by the Tinsel Town manager to retrieve
  65.  * the method pointers for a drawing engine.
  66.  *
  67.  * The TQAEngineCheckDevice function returns TRUE if the engine can render to the
  68.  * indicated GDevice.
  69.  *
  70.  ***********************************************************************************************/
  71.  
  72. typedef TQAError (*TQADrawPrivateNew) (
  73.     TQADrawContext        *newDrawContext,    /* Draw context to initialize */
  74.     const TQADevice        *device,            /* Target device */
  75.     const TQARect        *rect,                /* Target rectangle (device coordinates) */
  76.     const TQAClip        *clip,                /* 2D clip region (or NULL) */
  77.     unsigned long        flags);                /* Mask of kQAContext_xxx */
  78.  
  79. typedef void (*TQADrawPrivateDelete) (
  80.     TQADrawPrivate        *drawPrivate);        /* Private context data to delete */
  81.  
  82. typedef TQAError (*TQAEngineCheckDevice) (
  83.     const TQADevice        *device);            /* Target device */
  84.     
  85. typedef TQAError (*TQAEngineGestalt) (
  86.     TQAGestaltSelector    selector,            /* Gestalt parameter being requested */
  87.     void                *response);            /* Buffer that receives response */
  88.  
  89. /************************************************************************************************
  90.  *
  91.  * The TQAEngineMethod union is used to represent a single engine method (it's a
  92.  * parameter to QAEngineGetMethod). TQAEngineMethodTag identifies which method is being
  93.  * requested.
  94.  *
  95.  ***********************************************************************************************/
  96.  
  97. typedef union TQAEngineMethod
  98. {
  99.     TQADrawPrivateNew        drawPrivateNew;        /* Method: Create a private draw context */
  100.     TQADrawPrivateDelete    drawPrivateDelete;    /* Method: Delete a private draw context */
  101.     TQAEngineCheckDevice    engineCheckDevice;    /* Method: Check a device for drawing */
  102.     TQAEngineGestalt        engineGestalt;        /* Method: Gestalt */
  103.     TQATextureNew            textureNew;            /* Method: Create a texture (load is non-blocking) */
  104.     TQATextureDetach        textureDetach;        /* Method: Complete load of a texture (blocking) */
  105.     TQATextureDelete        textureDelete;        /* Method: Delete a texture */
  106.     TQABitmapNew            bitmapNew;            /* Method: Create a bitmap (load is non-blocking)  */
  107.     TQABitmapDetach            bitmapDetach;        /* Method: Complete load of a bitmap (blocking) */
  108.     TQABitmapDelete            bitmapDelete;        /* Method: Delete a bitmap */
  109. } TQAEngineMethod;
  110.  
  111. typedef enum TQAEngineMethodTag
  112. {
  113.     kQADrawPrivateNew        = 0,
  114.     kQADrawPrivateDelete    = 1,
  115.     kQAEngineCheckDevice    = 2,
  116.     kQAEngineGestalt        = 3,
  117.     kQATextureNew            = 4,
  118.     kQATextureDetach        = 5,
  119.     kQATextureDelete        = 6,
  120.     kQABitmapNew            = 7,
  121.     kQABitmapDetach            = 8,
  122.     kQABitmapDelete            = 9
  123. } TQAEngineMethodTag;
  124.  
  125. /************************************************************************************************
  126.  *
  127.  * QARegisterEngine() registers a new engine. This is called at boot time by the drawing engine
  128.  * initialization code to register itself with the system. This call takes only one parameter,
  129.  * the engine's function that allows the manager to request the other methods.
  130.  *
  131.  ***********************************************************************************************/
  132.  
  133. typedef TQAError (*TQAEngineGetMethod) (
  134.     TQAEngineMethodTag        methodTag,                /* Method being requested */
  135.     TQAEngineMethod            *method);                /* (Out) Method */
  136.  
  137. TQAError QARegisterEngine (
  138.     TQAEngineGetMethod        engineGetMethod);        /* Engine's getMethod method */
  139.  
  140. /************************************************************************************************
  141.  *
  142.  * The TQADrawMethod union is used to represent a single draw context method (it's a
  143.  * parameter to QARegisterDrawMethod). TQADrawMethodTag identifies which method is being
  144.  * passed.
  145.  *
  146.  ***********************************************************************************************/
  147.  
  148. typedef union TQADrawMethod
  149. {
  150.     TQASetFloat            setFloat;            /* Method: Set a float state variable */
  151.     TQASetInt            setInt;                /* Method: Set an unsigned long state variable */
  152.     TQASetPtr            setPtr;                /* Method: Set an unsigned long state variable */
  153.     TQAGetFloat            getFloat;            /* Method: Get a float state variable */
  154.     TQAGetInt            getInt;                /* Method: Get an unsigned long state variable */
  155.     TQAGetPtr            getPtr;                /* Method: Get an pointer state variable */
  156.     TQADrawPoint        drawPoint;            /* Method: Draw a point */
  157.     TQADrawLine            drawLine;            /* Method: Draw a line */
  158.     TQADrawTriGouraud    drawTriGouraud;        /* Method: Draw a Gouraud shaded triangle */
  159.     TQADrawTriTexture    drawTriTexture;        /* Method: Draw a texture mapped triangle */
  160.     TQADrawVGouraud        drawVGouraud;        /* Method: Draw Gouraud vertices */
  161.     TQADrawVTexture        drawVTexture;        /* Method: Draw texture vertices */
  162.     TQADrawBitmap        drawBitmap;            /* Method: Draw a bitmap */
  163.     TQARenderStart        renderStart;        /* Method: Initialize for rendering */
  164.     TQARenderEnd        renderEnd;            /* Method: Complete rendering and display */
  165.     TQARenderAbort        renderAbort;        /* Method: Abort any outstanding rendering (blocking) */
  166.     TQAFlush            flush;                /* Method: Start render of any queued commands (non-blocking) */
  167.     TQASync                sync;                /* Method: Wait for completion of all rendering (blocking) */
  168. } TQADrawMethod;
  169.  
  170. typedef enum TQADrawMethodTag
  171. {
  172.     kQASetFloat            = 0,
  173.     kQASetInt            = 1,
  174.     kQASetPtr            = 2,
  175.     kQAGetFloat            = 3,
  176.     kQAGetInt            = 4,
  177.     kQAGetPtr            = 5,
  178.     kQADrawPoint        = 6,
  179.     kQADrawLine            = 7,
  180.     kQADrawTriGouraud    = 8,
  181.     kQADrawTriTexture    = 9,
  182.     kQADrawVGouraud        = 10,
  183.     kQADrawVTexture        = 11,
  184.     kQADrawBitmap        = 12,
  185.     kQARenderStart        = 13,
  186.     kQARenderEnd        = 14,
  187.     kQARenderAbort        = 15,
  188.     kQAFlush            = 16,
  189.     kQASync                = 17
  190. } TQADrawMethodTag;
  191.  
  192. /************************************************************************************************
  193.  *
  194.  * System call to register a new method for an engine. This is called during the engine's
  195.  * draw private new functions (to set the initial value of the draw methods), and possibly
  196.  * at other times when the engine needs to change a draw method.
  197.  *
  198.  ***********************************************************************************************/
  199.  
  200. TQAError QARegisterDrawMethod (
  201.     TQADrawContext            *drawContext,            /* Draw context in which to set method */
  202.     TQADrawMethodTag        methodTag,                /* Method to set */
  203.     TQADrawMethod            method);                /* Method */
  204.  
  205. /************************************************************************************************
  206.  *
  207.  * Debugging functions.
  208.  *
  209.  ***********************************************************************************************/
  210.  
  211. #ifdef __cplusplus
  212. }
  213. #endif
  214.  
  215. #endif /* _Drive3D_system_h */
  216.